package com.lai.hospital.controller;

import com.lai.hospital.dto.DoctorBackDTO;
import com.lai.hospital.dto.DoctorScheduleDTO;
import com.lai.hospital.dto.DoctorSchedulePreviewDTO;
import com.lai.hospital.entity.DoctorSchedule;
import com.lai.hospital.service.DoctorScheduleService;
import com.lai.hospital.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author : lai
 * @version V1.0
 * @Project: hospital-springboot
 * @Package com.lai.hospital.controller
 * @Description: 医生排班控制器
 * @date Date : 2023年02月16日 23:35
 */
@RestController
@Api(value = "医生排班模块")
public class DoctorScheduleController {

    @Autowired
    private DoctorScheduleService doctorScheduleService;

    /**
     * 获取所以医生的一周排班列表
     * @param conditionVO 条件
     * @return
     */
    @GetMapping("/admin/schedule/week")
    @ApiOperation(value = "获取所有医生的一周排班列表")
    public Result<PageResult<DoctorBackDTO>> listDoctorScheduleWeek(ConditionVO conditionVO){
        return Result.ok(doctorScheduleService.listDoctorScheduleWeek(conditionVO));
    }

    /**
     *  添加医生排班信息
     * @param doctorScheduleVO 医生排班信息
     * @return
     */
    @PostMapping("/admin/saveDoctorSchedule")
    @ApiOperation(value = "添加医生排班信息")
    public Result<?> saveDoctorSchedule(@RequestBody DoctorScheduleVO doctorScheduleVO){
        doctorScheduleService.saveDoctorSchedule(doctorScheduleVO);
        return Result.ok();
    }

    /**
     * 根据医生id和时间获取排班信息
     * @return
     */
    @GetMapping("/user/getDoctorSchedule")
    @ApiOperation(value = "根据医生id和时间获取排班信息")
    public Result<List<DoctorSchedulePreviewDTO>> getDoctorScheduleByDoctorIdAndTime(DoctorSchedulePreviewVO doctorSchedulePreviewVO){
        return Result.ok(doctorScheduleService.getDoctorScheduleByDoctorIdAndTime(doctorSchedulePreviewVO));
    }




}
